package com.ruoyi.project.stats.service;

import com.ruoyi.project.stats.mapper.StatsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author LoKa
 * @date 2020-09-17 23:27
 */
@Service
public class StatsServiceImpl implements IStatsService {
    @Autowired
    private StatsMapper statsMapper;

    @Override
    public String[] selectDistinctTaskStatus() {
        return statsMapper.selectDistinctTaskStatus();
    }

    @Override
    public String[] selectDistinctTaskUrgency() {
        return statsMapper.selectDistinctTaskUrgency();
    }

    @Override
    public int getCountByStatusAndUrgency(String status, String urgency) {
        return statsMapper.getCountByStatusAndUrgency(status,urgency);
    }

    @Override
    public String[] selectDistinctProjectPhase() {
        return statsMapper.selectDistinctProjectPhase();
    }

    @Override
    public int getCountByPhase(String phase) {
        return statsMapper.getCountByPhase(phase);
    }

    @Override
    public String[] selectDistinctOrderType() {
        return statsMapper.selectDistinctOrderType();
    }

    @Override
    public String[] selectDistinctCustomerInfo() {
        return statsMapper.selectDistinctCustomerInfo();
    }

    @Override
    public Integer getCountByTypeAndCustomer(String orderType, String customer) {
        return statsMapper.getCountByTypeAndCustomer(orderType,customer);
    }

    @Override
    public Integer getAmountCountByCustomer(String customer) {
        return statsMapper.getAmountCountByCustomer(customer);
    }

    @Override
    public Integer getPaymentByCustomer(int flag, String customer) {
        if (flag==0) {
            return statsMapper.getAmountCountByCustomer(customer);
        }
        return statsMapper.getUnpaidAmount(customer);
    }
}
